home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat1
/
X11
/
xcalc.z
/
xcalc
Wrap
Text File
|
1998-10-30
|
25KB
|
529 lines
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
NNNNAAAAMMMMEEEE
xcalc - scientific calculator for X
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
xxxxccccaaaallllcccc [-stipple] [-rpn] [-_t_o_o_l_k_i_t_o_p_t_i_o_n...]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_x_c_a_l_c is a scientific calculator desktop accessory that can
emulate a TI-30 or an HP-10C.
OOOOPPPPTTTTIIIIOOOONNNNSSSS
_x_c_a_l_c accepts all of the standard toolkit command line
options along with two additional options:
----ssssttttiiiipppppppplllleeee
This option indicates that the background of the
calculator should be drawn using a stipple of the
foreground and background colors. On monochrome
displays improves the appearance.
----rrrrppppnnnn This option indicates that Reverse Polish Notation
should be used. In this mode the calculator will
look and behave like an HP-10C. Without this flag,
it will emulate a TI-30.
OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN
_P_o_i_n_t_e_r _U_s_a_g_e: Operations may be performed with pointer
button 1, or in some cases, with the keyboard. Many common
calculator operations have keyboard accelerators. To quit,
press pointer button 3 on the AC key of the TI calculator,
or the ON key of the HP calculator.
_C_a_l_c_u_l_a_t_o_r _K_e_y _U_s_a_g_e (_T_I _m_o_d_e): The numbered keys, the +/-
key, and the +, -, *, /, and = keys all do exactly what you
would expect them to. It should be noted that the operators
obey the standard rules of precedence. Thus, entering
"3+4*5=" results in "23", not "35". The parentheses can be
used to override this. For example, "(1+2+3)*(4+5+6)="
results in "6*15=90".
The entire number in the calculator display can be selected,
in order to paste the result of a calculation into text.
The action procedures associated with each function are
given below. These are useful if you are interested in
defining a custom calculator. The action used for all digit
keys is ddddiiiiggggiiiitttt((((_n)))), where _n is the corresponding digit, 0..9.
1111////xxxx Replaces the number in the display with its
reciprocal. The corresponding action procedure is
rrrreeeecccciiiipppprrrrooooccccaaaallll(((()))).
Page 1 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
xxxx^^^^2222 Squares the number in the display. The
corresponding action procedure is ssssqqqquuuuaaaarrrreeee(((()))).
SSSSQQQQRRRRTTTT Takes the square root of the number in the
display. The corresponding action procedure is
ssssqqqquuuuaaaarrrreeeeRRRRooooooootttt(((()))).
CCCCEEEE////CCCC When pressed once, clears the number in the
display without clearing the state of the machine.
Allows you to re-enter a number if you make a
mistake. Pressing it twice clears the state,
also. The corresponding action procedure for TI
mode is cccclllleeeeaaaarrrr(((()))).
AAAACCCC Clears the display, the state, and the memory.
Pressing it with the third pointer button turns
off the calculator, in that it exits the program.
The action procedure to clear the state is ooooffffffff(((())));
to quit, qqqquuuuiiiitttt(((()))).
IIIINNNNVVVV Invert function. See the individual function keys
for details. The corresponding action procedure
is iiiinnnnvvvveeeerrrrsssseeee(((()))).
ssssiiiinnnn Computes the sine of the number in the display, as
interpreted by the current DRG mode (see DRG,
below). If inverted, it computes the arcsine.
The corresponding action procedure is ssssiiiinnnneeee(((()))).
ccccoooossss Computes the cosine, or arccosine when inverted.
The corresponding action procedure is ccccoooossssiiiinnnneeee(((()))).
ttttaaaannnn Computes the tangent, or arctangent when inverted.
The corresponding action procedure is ttttaaaannnnggggeeeennnntttt(((()))).
DDDDRRRRGGGG Changes the DRG mode, as indicated by 'DEG',
'RAD', or 'GRAD' at the bottom of of the
calculator ``liquid crystal'' display. When in
'DEG' mode, numbers in the display are taken as
being degrees. In 'RAD' mode, numbers are in
radians, and in 'GRAD' mode, numbers are in grads.
When inverted, the DRG key has a feature of
converting degrees to radians to grads and vice-
versa. Example: put the calculator into 'DEG'
mode, and enter "45 INV DRG". The display should
now show something along the lines of ".785398",
which is 45 degrees converted to radians. The
corresponding action procedure is ddddeeeeggggrrrreeeeeeee(((()))).
eeee The constant 'e'. (2.7182818...). The
corresponding action procedure is eeee(((()))).
Page 2 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
EEEEEEEE Used for entering exponential numbers. For
example, to get "-2.3E-4" you'd enter "2 . 3 +/-
EE 4 +/-". The corresponding action procedure is
sssscccciiiieeeennnnttttiiiiffffiiiicccc(((()))).
lllloooogggg Calculates the log (base 10) of the number in the
display. When inverted, it raises "10.0" to the
number in the display. For example, entering "3
INV log" should result in "1000". The
corresponding action procedure is llllooooggggaaaarrrriiiitttthhhhmmmm(((()))).
llllnnnn Calculates the log (base e) of the number in the
display. When inverted, it raises "e" to the
number in the display. For example, entering "e
ln" should result in "1". The corresponding
action procedure is nnnnaaaattttuuuurrrraaaallllLLLLoooogggg(((()))).
yyyy^^^^xxxx Raises the number on the left to the power of the
number on the right. For example "2 y^x 3 ="
results in "8", which is 2^3. For a further
example, "(1+2+3) y^x (1+2) =" equals "6 y^x 3"
which equals "216". The corresponding action
procedure is ppppoooowwwweeeerrrr(((()))).
PPPPIIII The constant 'pi'. (3.1415927....) The
corresponding action procedure is ppppiiii(((()))).
xxxx!!!! Computes the factorial of the number in the
display. The number in the display must be an
integer in the range 0-500, though, depending on
your math library, it might overflow long before
that. The corresponding action procedure is
ffffaaaaccccttttoooorrrriiiiaaaallll(((()))).
(((( Left parenthesis. The corresponding action
procedure for TI calculators is lllleeeeffffttttPPPPaaaarrrreeeennnn(((()))).
)))) Right parenthesis. The corresponding action
procedure for TI calculators is rrrriiiigggghhhhttttPPPPaaaarrrreeeennnn(((()))).
//// Division. The corresponding action procedure is
ddddiiiivvvviiiiddddeeee(((()))).
**** Multiplication. The corresponding action
procedure is mmmmuuuullllttttiiiippppllllyyyy(((()))).
---- Subtraction. The corresponding action procedure
is ssssuuuubbbbttttrrrraaaacccctttt(((()))).
++++ Addition. The corresponding action procedure is
aaaadddddddd(((()))).
Page 3 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
==== Perform calculation. The TI-specific action
procedure is eeeeqqqquuuuaaaallll(((()))).
SSSSTTTTOOOO Copies the number in the display to the memory
location. The corresponding action procedure is
ssssttttoooorrrreeee(((()))).
RRRRCCCCLLLL Copies the number from the memory location to the
display. The corresponding action procedure is
rrrreeeeccccaaaallllllll(((()))).
SSSSUUUUMMMM Adds the number in the display to the number in
the memory location. The corresponding action
procedure is ssssuuuummmm(((()))).
EEEEXXXXCCCC Swaps the number in the display with the number in
the memory location. The corresponding action
procedure for the TI calculator is eeeexxxxcccchhhhaaaannnnggggeeee(((()))).
++++////---- Negate; change sign. The corresponding action
procedure is nnnneeeeggggaaaatttteeee(((()))).
.... Decimal point. The action procedure is ddddeeeecccciiiimmmmaaaallll(((()))).
_C_a_l_c_u_l_a_t_o_r _K_e_y _U_s_a_g_e (_R_P_N _m_o_d_e): The number keys, CHS
(change sign), +, -, *, /, and ENTR keys all do exactly what
you would expect them to do. Many of the remaining keys are
the same as in TI mode. The differences are detailed below.
The action procedure for the ENTR key is eeeennnntttteeeerrrr(((()))).
<<<<---- This is a backspace key that can be used if you
make a mistake while entering a number. It will
erase digits from the display. (See BUGS).
Inverse backspace will clear the X register. The
corresponding action procedure is bbbbaaaacccckkkk(((()))).
OOOONNNN Clears the display, the state, and the memory.
Pressing it with the third pointer button turns
off the calculator, in that it exits the program.
To clear state, the action procedure is ooooffffffff; to
quit, qqqquuuuiiiitttt(((()))).
IIIINNNNVVVV Inverts the meaning of the function keys. This
would be the _f key on an HP calculator, but _x_c_a_l_c
does not display multiple legends on each key.
See the individual function keys for details.
11110000^^^^xxxx Raises "10.0" to the number in the top of the
stack. When inverted, it calculates the log (base
10) of the number in the display. The
Page 4 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
corresponding action procedure is tttteeeennnnppppoooowwwweeeerrrr(((()))).
eeee^^^^xxxx Raises "e" to the number in the top of the stack.
When inverted, it calculates the log (base e) of
the number in the display. The action procedure
is eeeeppppoooowwwweeeerrrr(((()))).
SSSSTTTTOOOO Copies the number in the top of the stack to a
memory location. There are 10 memory locations.
The desired memory is specified by following this
key with a digit key.
RRRRCCCCLLLL Pushes the number from the specified memory
location onto the stack.
SSSSUUUUMMMM Adds the number on top of the stack to the number
in the specified memory location.
xxxx::::yyyy Exchanges the numbers in the top two stack
positions, the X and Y registers. The
corresponding action procedure is XXXXeeeexxxxcccchhhhaaaannnnggggeeeeYYYY(((()))).
RRRR vvvv Rolls the stack downward. When inverted, it rolls
the stack upward. The corresponding action
procedure is rrrroooollllllll(((()))).
_b_l_a_n_k These keys were used for programming functions on
the HP-10C. Their functionality has not been
duplicated in _x_c_a_l_c.
Finally, there are two additional action procedures:
bbbbeeeellllllll(((()))), which rings the bell; and sssseeeelllleeeeccccttttiiiioooonnnn(((()))), which
performs a cut on the entire number in the calculator's
``liquid crystal'' display.
AAAACCCCCCCCEEEELLLLEEEERRRRAAAATTTTOOOORRRRSSSS
Accelerators are shortcuts for entering commands. _x_c_a_l_c
provides some sample keyboard accelerators; also users can
customize accelerators. The numeric keypad accelerators
provided by _x_c_a_l_c should be intuitively correct. The
accelerators defined by _x_c_a_l_c on the main keyboard are given
below:
TI Key HP Key Keyboard Accelerator TI Function HP Function
SQRT SQRT r squareRoot() squareRoot()
AC ON space clear() clear()
AC <- Delete clear() back()
AC <- Backspace clear() back()
AC <- Control-H clear() back()
AC Clear clear()
AC ON q quit() quit()
Page 5 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
AC ON Control-C quit() quit()
INV i i inverse() inverse()
sin s s sine() sine()
cos c c cosine() cosine()
tan t t tangent() tangent()
DRG DRG d degree() degree()
e e e()
ln ln l naturalLog() naturalLog()
y^x y^x ^ power() power()
PI PI p pi() pi()
x! x! ! factorial() factorial()
( ( leftParen()
) ) rightParen()
/ / / divide() divide()
* * * multiply() multiply()
- - - subtract() subtract()
+ + + add() add()
= = equal()
0..9 0..9 0..9 digit() digit()
. . . decimal() decimal()
+/- CHS n negate() negate()
x:y x XexchangeY()
ENTR Return enter()
ENTR Linefeed enter()
CCCCUUUUSSSSTTTTOOOOMMMMIIIIZZZZAAAATTTTIIIIOOOONNNN
The application class name is XCalc.
_x_c_a_l_c has an enormous application defaults file which
specifies the position, label, and function of each key on
the calculator. It also gives translations to serve as
keyboard accelerators. Because these resources are not
specified in the source code, you can create a customized
calculator by writing a private application defaults file,
using the Athena Command and Form widget resources to
specify the size and position of buttons, the label for each
button, and the function of each button.
The foreground and background colors of each calculator key
can be individually specified. For the TI calculator, a
classical color resource specification might be:
XCalc.ti.Command.background: gray50
XCalc.ti.Command.foreground: white
For each of buttons 20, 25, 30, 35, and 40, specify:
Page 6 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
XCalc.ti.button20.background: black
XCalc.ti.button20.foreground: white
For each of buttons 22, 23, 24, 27, 28, 29, 32, 33, 34, 37,
38, and 39:
XCalc.ti.button22.background: white
XCalc.ti.button22.foreground: black
WWWWIIIIDDDDGGGGEEEETTTT HHHHIIIIEEEERRRRAAAARRRRCCCCHHHHYYYY
In order to specify resources, it is useful to know the
hierarchy of the widgets which compose _x_c_a_l_c. In the
notation below, indentation indicates hierarchical
structure. The widget class name is given first, followed
by the widget instance name.
XCalc xcalc
Form ti _o_r hp (_t_h_e _n_a_m_e _d_e_p_e_n_d_s _o_n _t_h_e _m_o_d_e)
Form bevel
Form screen
Label M
Toggle LCD
Label INV
Label DEG
Label RAD
Label GRAD
Label P
Command button1
Command button2
Command button3
_a_n_d _s_o _o_n, ...
Command button38
Command button39
Command button40
AAAAPPPPPPPPLLLLIIIICCCCAAAATTTTIIIIOOOONNNN RRRREEEESSSSOOOOUUUURRRRCCCCEEEESSSS
rrrrppppnnnn (Class RRRRppppnnnn)
Specifies that the rpn mode should be used. The
default is TI mode.
ssssttttiiiipppppppplllleeee (Class SSSSttttiiiipppppppplllleeee)
Indicates that the background should be stippled.
The default is ``on'' for monochrome displays, and
``off'' for color displays.
ccccuuuurrrrssssoooorrrr (Class CCCCuuuurrrrssssoooorrrr)
The name of the symbol used to represent the
pointer. The default is ``hand2''.
CCCCOOOOLLLLOOOORRRRSSSS
If you would like xcalc to use its ti colors, include the
following in the #ifdef COLOR section of the file you read
with xrdb:
Page 7 (printed 4/30/98)
XXXXCCCCAAAALLLLCCCC((((1111)))) XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555)))) XXXXCCCCAAAALLLLCCCC((((1111))))
*customization: -color
This will cause xcalc to pick up the colors in the app-
defaults color customization file: /usr/lib/X11/app-
defaults/XCalc-color.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
X(1), xrdb(1), the Athena Widget Set
BBBBUUUUGGGGSSSS
HP mode: A bug report claims that the sequence of keys 5,
ENTER, <- should clear the display, but it doesn't.
CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
Copyright 1988, 1989, Massachusetts Institute of Technology.
See _X(_1) for a full statement of rights and permissions.
AAAAUUUUTTTTHHHHOOOORRRRSSSS
John Bradley, University of Pennsylvania
Mark Rosenstein, MIT Project Athena
Donna Converse, MIT X Consortium
Page 8 (printed 4/30/98)